﻿Imports Sunisoft.IrisSkin
Imports System.Data.SqlClient
Imports System.IO
Public Class Frm_QLMain
    Dim skin As SkinEngine

    Private Sub Frm_QLMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        KetNoiSQL()
        loadSkin("skins\MP10.ssk")
        'Frm_DangNhap.ShowDialog()
        Me.toolngl.Text = "Ngày Làm Việc: " & Now.Day.ToString & "/" & Now.Month.ToString & "/" & Now.Year
    End Sub


#Region "thay doi skin"
    Public Sub New()
        ' This call is required by the Windows Form Designer.
        InitializeComponent()
        ' Add an initialization after the InitializeComponent() call.
        skin = New SkinEngine
        skin.SerialNumber = "Y89DFfB3yDTWITfDt5ZwPIrz6rhiM3ayC895MX14kiJ+Bn5fwDsogQ=="
        skin.BuiltIn = True
        skin.SkinAllForm = True
        skin.Active = False
        'loadSkinsMenu()
        loadSkin("Vista.ssk")

    End Sub
    'Private Sub menu_click(ByVal send As Object, ByVal ea As EventArgs)
    '    Dim menu As ToolStripMenuItem = CType(send, ToolStripMenuItem)
    '    'For Each tsm As ToolStripMenuItem In ChangeSkin.DropDownItems
    '        'tsm.Checked = False
    '    Next tsm
    '   ' If menu Is ChangeSkin.DropDownItems(0) Then
    '        skin.SkinAllForm = False
    '        skin.Active = False
    '        menu.Checked = True
    '        Return
    '   ' End If
    '    Dim skinlocal As String = "skins\" & menu.Text & ".ssk"
    '    loadSkin(skinlocal)
    '    menu.Checked = True
    'End Sub
    'Hàm load skin menu
    'Private Sub loadSkinsMenu()
    '    Try
    '        Dim files() As String = Directory.GetFiles("skins", "*.ssk", SearchOption.TopDirectoryOnly)
    '        Dim skinmenu(files.Length - 1) As ToolStripMenuItem
    '        Dim defaultSkin As New ToolStripMenuItem()
    '        'defaultSkin.Text = "Longhorn"

    '        defaultSkin.Checked = True
    '        AddHandler defaultSkin.Click, AddressOf menu_click
    '        ChangeSkin.DropDownItems.Add(defaultSkin)
    '        For i As Integer = 0 To files.Length - 1
    '            Dim temp() As String = files(i).Split("\")
    '            temp = temp(temp.Length - 1).Split(".")
    '            skinmenu(i) = New ToolStripMenuItem()
    '            skinmenu(i).Text = temp(0)
    '            AddHandler skinmenu(i).Click, AddressOf menu_click
    '            ChangeSkin.DropDownItems.Add(skinmenu(i))
    '        Next i
    '    Catch ex As Exception
    '        MessageBox.Show(ex.Message, "L?i", MessageBoxButtons.OK, MessageBoxIcon.Error)
    '    End Try
    'End Sub
    Private Sub loadSkin(ByVal skinFile As String)
        Try
            skin.SkinFile = skinFile
            skin.SkinAllForm = True
            skin.Active = True
        Catch
            MessageBox.Show("Lỗi.", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
#End Region
    Private Sub mnu_PhieuNhap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_PhieuNhap.Click
        Frm_PhieuNhap.MdiParent = Me
        Frm_PhieuNhap.Show()
    End Sub

    Private Sub mnu_HoaDon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_HoaDon.Click
        Frm_HoaDon.MdiParent = Me
        Frm_HoaDon.Show()
    End Sub

    Private Sub mnu_tkpn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_tkpn.Click
        TK_PhieuNhap.MdiParent = Me
        TK_PhieuNhap.Show()


    End Sub

    Private Sub mnu_DVT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_DVT.Click
        Frm_DonViTinh.ShowDialog()
    End Sub

    Private Sub mnu_LoaiSP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_LoaiSP.Click
        Frm_LoaiSP.MdiParent = Me
        Frm_LoaiSP.Show()
    End Sub

    Private Sub mnu_sanpham_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_sanpham.Click
        Frm_SanPham.MdiParent = Me
        Frm_SanPham.Show()
    End Sub

    Private Sub mnu_NCC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_NCC.Click
        Frm_NhaCungCap.MdiParent = Me
        Frm_NhaCungCap.Show()
    End Sub

    Private Sub mnu_NhanVien_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_NhanVien.Click
        Frm_NhanVien.MdiParent = Me
        Frm_NhanVien.Show()
    End Sub

    Private Sub mnu_Soluongton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_Soluongton.Click
        TK_SanPhamTon.MdiParent = Me
        TK_SanPhamTon.Show()
    End Sub

    Private Sub mnu_tkhoadon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_tkhoadon.Click
        TK_HoaDon.MdiParent = Me
        TK_HoaDon.Show()
    End Sub
    Private Sub mn_phieunhap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_phieunhap.Click
        Frm_PhieuNhap.MdiParent = Me
        Frm_PhieuNhap.Show()
    End Sub

    Private Sub mu_hoadon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mu_hoadon.Click
        Frm_HoaDon.MdiParent = Me
        Frm_HoaDon.Show()
    End Sub
    Private Sub mn_thoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_thoat.Click
        Application.Exit()
    End Sub

    Private Sub mn_tk_phieunhap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_tk_phieunhap.Click
        TK_PhieuNhap.MdiParent = Me
        TK_PhieuNhap.Show()
    End Sub
    Private Sub mn_tk_hoadon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_tk_hoadon.Click
        TK_HoaDon.MdiParent = Me
        TK_HoaDon.Show()
    End Sub
    Private Sub mn_tk_ton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_tk_ton.Click
        TK_SanPhamTon.MdiParent = Me
        TK_SanPhamTon.Show()
    End Sub
    Private Sub mn_sanpham_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_sanpham.Click
        Frm_SanPham.MdiParent = Me
        Frm_SanPham.Show()
    End Sub

    Private Sub mn_loaisp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_loaisp.Click
        Frm_LoaiSP.MdiParent = Me
        Frm_LoaiSP.Show()
    End Sub

    Private Sub mn_dvt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_dvt.Click
        Frm_LoaiSP.MdiParent = Me
        Frm_LoaiSP.Show()
    End Sub

    Private Sub mn_ncc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_ncc.Click
        Frm_NhaCungCap.MdiParent = Me
        Frm_NhaCungCap.Show()
    End Sub
    Private Sub mn_hoadon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_hoadon.Click
        R_HoaDon.MdiParent = Me
        R_HoaDon.Show()
    End Sub
    Private Sub mnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnthoat.Click
        Application.Exit()
    End Sub
    Private Sub mn_tl_tonsp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_tl_tonsp.Click
        TK_SanPhamTon.MdiParent = Me
        TK_SanPhamTon.Show()
    End Sub

    Private Sub mn_tk_hd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_tk_hd.Click
        TK_HoaDon.MdiParent = Me
        TK_HoaDon.Show()
    End Sub

    Private Sub mn_tk_pn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mn_tk_pn.Click
        TK_PhieuNhap.MdiParent = Me
        TK_PhieuNhap.Show()
    End Sub
End Class